﻿package mortal.game.view.relive
{
    import com.mui.display.*;
    import com.mui.utils.*;
    import mortal.game.cache.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.scene3D.ai.ais.*;
    import mortal.game.view.common.*;
    import mortal.game.view.relive.parts.*;
    import mortal.mvc.interfaces.*;

    public class RelivePanelGeneral extends RelivePanelBase
    {
        private var _leftSecondsPart:ReliveLeftSecondPart;
        private var _localRelivePart:ReliveLocalPart;
        private var _vLine:ScaleBitmap;

        public function RelivePanelGeneral(param1:ILayer = null)
        {
            super(param1);
            return;
        }// end function

        override public function setLeftTime(param1:int) : void
        {
            this._localRelivePart.setLeftTime(param1, this.timerOutHandler);
            return;
        }// end function

        private function timerOutHandler() : void
        {
            if (AutoFightAI.isWorking)
            {
                if (Cache.instance.autoFight.isAutoRelieve)
                {
                    GameController.relive.roleDead();
                }
            }
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._leftSecondsPart = UICompomentPool.getUICompoment(ReliveLeftSecondPart) as ReliveLeftSecondPart;
            this._leftSecondsPart.x = sx + 32;
            this._leftSecondsPart.y = sy + 18;
            this.addChild(this._leftSecondsPart);
            this._leftSecondsPart.hideTimer();
            this._vLine = UIFactory.bg(sx + 304, sy + 27, 2, 130, this, ImagesConst.VSplitLine);
            this._localRelivePart = UICompomentPool.getUICompoment(ReliveLocalPart) as ReliveLocalPart;
            this._localRelivePart.x = sx + 319;
            this._localRelivePart.y = sy + 44;
            this.addChild(this._localRelivePart);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._leftSecondsPart.dispose(param1);
            this._leftSecondsPart = null;
            this._vLine.dispose(param1);
            this._vLine = null;
            this._localRelivePart.dispose(param1);
            this._localRelivePart = null;
            return;
        }// end function

    }
}
